/***************************************************************************
 *   Copyright (C) 2007 by Phillip Aldridge   *
 *   phillip@imi21.com   *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/
#include "stationdlg.h"
#include <qlayout.h>
#include <qlabel.h>
#include <qcheckbox.h>
#include <qspinbox.h>
StationDlg::StationDlg(QWidget* parent):
         QDialog( parent)
{
   setCaption ( "Station configuration");
   QBoxLayout * topLayout = new QVBoxLayout( this,5,5 );
   QBoxLayout * b1 = new QHBoxLayout( topLayout );
   QBoxLayout * b2 = new QHBoxLayout( topLayout );
   QBoxLayout * b3 = new QHBoxLayout( topLayout );
   QBoxLayout * bButtons = new QHBoxLayout( topLayout );

   QLabel *label1 = new QLabel( "Light on update : ", this );
   b1->addWidget( label1);
   QCheckBox  *cb1=  new QCheckBox ( "on", this );
   b1->addWidget( cb1);

   QLabel *label2 = new QLabel( "Update rate (miniutes) : ", this );
   b2->addWidget( label2);
   sp2= new QSpinBox(1,60,1,this);
   b2->addWidget( sp2);

   QLabel *label3 = new QLabel( "Device port : ", this );
   b3->addWidget( label3);
   QSpinBox  *sp3= new QSpinBox(1,60,1,this);
   b3->addWidget( sp3);

   butReset = new QPushButton("&Reset", this);
   butCancel = new QPushButton("&Cancel", this);
   butOK = new QPushButton("&OK", this );

   bButtons->addWidget( butReset );
   bButtons->addWidget( butCancel );
   bButtons->addWidget( butOK );

   topLayout->activate();

   connect( butReset, SIGNAL( clicked() ), this, SLOT( reset() ) ); 
   connect( butCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
   connect( butOK, SIGNAL( clicked() ), this, SLOT( accept() ) );

}


StationDlg::~StationDlg()
{
}
void StationDlg::reset()
{
   qDebug( "Reset");
}
void StationDlg::setStationUpdate(int i)
{
stationUpdate=i;
sp2->setValue(stationUpdate);
}
int StationDlg::stationUpdateRate()
{
stationUpdate=sp2->value();

return stationUpdate;
}
void StationDlg::accept()
{
   QDialog::accept();
}
void StationDlg::reject()
{
   QDialog::reject();
}

